# -*- coding:utf-8 -*-
# @Author: shenyuyu
# @Time: 2023/6/26 11:19
# @File: qu_6_takeOrder.py
from pyspark import SparkConf, SparkContext

if __name__ == '__main__':
    conf = SparkConf().setAppName("test").setMaster("local[*]")
    sc = SparkContext(conf=conf)

    rdd = sc.parallelize([1, 3, 2, 4, 7, 9, 6])

    print(rdd.takeOrdered(3))

    print(rdd.takeOrdered(3, lambda x: -x))